<?php


namespace App\Api\Controllers;


use App\Api\Repositories\GeoRepositorie;
use App\Api\Services\JsonService;
use Illuminate\Http\Request;

class RedisGeoController
{
    public function geoGet(Request $request)
    {
        //获得用户当前位置(用户可输入)
        $valadate = $request->validate([
           'addr'=>['required'],
           'uid'=>['required']
        ]);
        $meter = GeoRepositorie::getinfo($valadate['addr'],(int)$valadate['uid']);
        if(!empty($meter)){
            return JsonService::success('查询成功',$meter,config('code.HTTP_OK'));
        }else{
            return JsonService::fail('查询失败','',config('code.HTTP_FAIL'));
        }
    }
}